<?php
namespace app\admin\controller;



use app\admin\logic\OrderLogic;
use app\admin\model\Order;
use app\BaseController;
use think\facade\Request;
use think\facade\View;
//订单管理
class Admin extends BaseController
{
    //订单列表
    public function orderList()
    {
        echo 1;
        echo 2;
        //接值
        $param = Request::param();
        //拼接where语句
        $where = OrderLogic::orderWhere($param);
        //留值
        $data = OrderLogic::orderData($param);
        View::assign($data);
        //订单状态循环查询
        $line = \app\admin\model\Order::getOrderStatus();
        View::assign('line',$line);
        //查询语句
        $list = \app\admin\model\Order::getOrderList($where,$data);
        $page = $list->render();
        View::assign(['list'=>$list,'page'=>$page]);
        return View::fetch();
    }
    //订单查看
    public function orderDetail()
    {
        //接值
        $get = Request::get();
        //查询该订单详情
        list($list,$user) = Order::getOrderSelect($get);
        View::assign(['list'=>$list,'user'=>$user]);
        return View::fetch();
    }
    //处理发货
    public function orderDeliver()
    {
        //接值
        $get = Request::get();
        //处理发货数据
        $res = Order::getOrderDeliver($get);
        //判断是否修改
        if ($res){
            $this->success('发货成功','orderList');
        }else{
            $this->error('发货失败');
        }
    }
    //单个删除订单
    public function orderDel()
    {
        //接值
        $get = Request::get();
        //模型层软删
        $res = Order::delOrder($get);
        if ($res){
            $this->success('删除成功',url('orderList'));
        }else{
            $this->error('删除失败');
        }
    }
    //多个删除订单
    public function orderDels()
    {
        //接值
        $get = Request::get();
        //模型层软删
        $res = Order::delsOrder($get);
        if ($res){
            $this->success('删除成功',url('orderList'));
        }else{
            $this->error('删除失败');
        }
    }
    //空控制器

}